home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / OptionsQlicker.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  9.5 KB  |  213 lines

  1. package com.extensibility.xa;
  2.  
  3. import com.extensibility.app.BaseAction;
  4. import com.extensibility.app.UI;
  5. import com.extensibility.rock.BaseMenu;
  6. import com.extensibility.rock.RAction;
  7. import com.extensibility.rock.RJMenu;
  8. import com.extensibility.rock.ScrollPop;
  9. import com.extensibility.rock.table.QlickerCellEditor;
  10. import com.extensibility.rock.table.QlickerDataSource;
  11. import com.extensibility.xml.dt.DataTypeFactory;
  12. import com.extensibility.xml.dt.DataTypeIntf;
  13. import com.extensibility.xml.dt.Facet;
  14. import java.awt.Color;
  15. import java.awt.FlowLayout;
  16. import java.awt.Font;
  17. import java.awt.event.MouseEvent;
  18. import java.util.Enumeration;
  19. import javax.swing.AbstractButton;
  20. import javax.swing.BorderFactory;
  21. import javax.swing.Icon;
  22. import javax.swing.JCheckBoxMenuItem;
  23. import javax.swing.JMenuItem;
  24. import javax.swing.JPanel;
  25. import javax.swing.JPopupMenu;
  26. import javax.swing.SwingUtilities;
  27. import javax.swing.text.Document;
  28. import javax.swing.text.JTextComponent;
  29.  
  30. public class OptionsQlicker extends QlickerCellEditor {
  31.    final Color FRAME_COLOR = UI.getColor(2);
  32.    final Color BTN_COLOR = UI.getColor(1);
  33.    Icon icnPop = UI.getIcon("pop.gif");
  34.    public static final String POPUP_DATA = "OPTIONS";
  35.    public static final String REUSABLES = "REUSABLES";
  36.    QlickerBtn btnNotationList;
  37.    SchemaDoc doc;
  38.    RAction actionListener = new 1(this);
  39.    RAction createAction = new 2(this);
  40.    RAction editAction = new 3(this);
  41.    RAction digitsAction = new 4(this);
  42.    RAction decimalsAction = new 5(this);
  43.    RAction minAction = new 6(this);
  44.    RAction maxAction = new 7(this);
  45.    BaseAction minExcludeAction = new 8(this, "oq.minexclusive");
  46.    BaseAction maxExcludeAction = new 9(this, "oq.maxexclusive");
  47.    RAction enumerationAction = new 10(this);
  48.    RAction lengthAction = new 11(this);
  49.    RAction maxLengthAction = new 12(this);
  50.    RAction minLengthAction = new 13(this);
  51.    RAction patternAction = new 14(this);
  52.    RAction encodingAction = new 15(this);
  53.    RAction periodAction = new 16(this);
  54.  
  55.    public OptionsQlicker(SchemaDoc var1, QlickerDataSource var2) {
  56.       super(var2);
  57.       this.doc = var1;
  58.    }
  59.  
  60.    protected JPanel createButtonPanel() {
  61.       super.btnPanel = new JPanel();
  62.       super.btnPanel.setBorder(BorderFactory.createLineBorder(this.FRAME_COLOR));
  63.       FlowLayout var1 = new FlowLayout();
  64.       var1.setHgap(0);
  65.       var1.setVgap(0);
  66.       super.btnPanel.setLayout(var1);
  67.       Font var2 = new Font("Dialog", 0, 9);
  68.       super.btnPanel.setFont(var2);
  69.       this.btnNotationList = new QlickerBtn(UI.getString("oq.options"), this.icnPop);
  70.       this.btnNotationList.setBackground(this.BTN_COLOR);
  71.       this.btnNotationList.addMouseListener(new Popper(this));
  72.       super.btnPanel.add(this.btnNotationList);
  73.       super.btnPanel.setSize(super.btnPanel.getLayout().preferredLayoutSize(super.btnPanel));
  74.       return super.btnPanel;
  75.    }
  76.  
  77.    private SchemaDoc getSchemaDoc() {
  78.       return this.doc;
  79.    }
  80.  
  81.    protected Document createDocument() {
  82.       return new OptionsDocument(this);
  83.    }
  84.  
  85.    public void insertName(String var1) {
  86.       if (((QlickerCellEditor)this).needsChar(((QlickerCellEditor)this).getText(), ((JTextComponent)this).getSelectionStart(), '|')) {
  87.          var1 = String.valueOf("| ").concat(String.valueOf(var1));
  88.       }
  89.  
  90.       ((JTextComponent)this).replaceSelection(var1);
  91.    }
  92.  
  93.    public JPanel adoptBtnPanel() {
  94.       super.btnPanel.remove(0);
  95.       super.btnPanel.revalidate();
  96.       return super.adoptBtnPanel();
  97.    }
  98.  
  99.    private SchemaWin getSchemaWin() {
  100.       return (SchemaWin)SwingUtilities.windowForComponent(this);
  101.    }
  102.  
  103.    protected JPopupMenu createPopup(MouseEvent var1) {
  104.       return this.createPopup((ScrollPop)super.createPopup(var1));
  105.    }
  106.  
  107.    protected ScrollPop createPopdown() {
  108.       return this.createPopup((ScrollPop)null);
  109.    }
  110.  
  111.    protected ScrollPop createPopup(ScrollPop var1) {
  112.       if (var1 == null) {
  113.          var1 = new ScrollPop();
  114.       } else {
  115.          var1.addSeparator();
  116.       }
  117.  
  118.       BaseMenu var3 = new BaseMenu(UI.getString("oq.structure"));
  119.       JMenuItem var2 = ((RJMenu)var3).add(UI.getString("oq.create"));
  120.       ((AbstractButton)var2).addActionListener(this.createAction);
  121.       var2 = ((RJMenu)var3).add(UI.getString("oq.edit"));
  122.       ((AbstractButton)var2).addActionListener(this.editAction);
  123.       var3.addSeparator();
  124.       if (super.dataSource != null) {
  125.          Enumeration var4 = (Enumeration)super.dataSource.getQlickerData("REUSABLES", new Integer(super.table.getEditingRow()));
  126.  
  127.          while(var4.hasMoreElements()) {
  128.             String var5 = (String)var4.nextElement();
  129.             var2 = var3.add(new JMenuItem(var5));
  130.             ((AbstractButton)var2).addActionListener(this.actionListener);
  131.          }
  132.       }
  133.  
  134.       if (this.getSchemaDoc().getSchema().isSupported("GESTALT_REUSABLE_CONSTRAINTS") || this.getSchemaDoc().getSchema().isSupported("GESTALT_REUSABLE_TEXT")) {
  135.          var1.add(var3);
  136.          var1.addSeparator();
  137.       }
  138.  
  139.       boolean var25 = true;
  140.       var2 = ((JPopupMenu)var1).add(UI.getString("oq.digits"));
  141.       ((AbstractButton)var2).addActionListener(this.digitsAction);
  142.       var2.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_DIGITS"));
  143.       var2 = ((JPopupMenu)var1).add(UI.getString("oq.decimals"));
  144.       ((AbstractButton)var2).addActionListener(this.decimalsAction);
  145.       var2.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_DECIMALS"));
  146.       var2 = ((JPopupMenu)var1).add(UI.getString("oq.min"));
  147.       ((AbstractButton)var2).addActionListener(this.minAction);
  148.       var2.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_MIN"));
  149.       var2 = ((JPopupMenu)var1).add(UI.getString("oq.max"));
  150.       ((AbstractButton)var2).addActionListener(this.maxAction);
  151.       var2.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_MAX"));
  152.       DataTypeIntf var26 = DataTypeFactory.createDataType(DataTypeIntf.NUMBER).setOptions(((QlickerCellEditor)this).getText());
  153.       Facet var6 = var26.getFacet(Facet.FACET_MINEX_NAME);
  154.       JCheckBoxMenuItem var15 = var1.addAsCheckBox(this.minExcludeAction);
  155.       ((JMenuItem)var15).setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_MINEX"));
  156.       if (var6 != null) {
  157.          ((AbstractButton)var15).setSelected(((String)var6.getValue()).equals("true"));
  158.       } else {
  159.          ((AbstractButton)var15).setSelected(false);
  160.       }
  161.  
  162.       var15 = var1.addAsCheckBox(this.maxExcludeAction);
  163.       ((JMenuItem)var15).setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_MAXEX"));
  164.       var6 = var26.getFacet(Facet.FACET_MAXEX_NAME);
  165.       if (var6 != null) {
  166.          ((AbstractButton)var15).setSelected(((String)var6.getValue()).equals("true"));
  167.       } else {
  168.          ((AbstractButton)var15).setSelected(false);
  169.       }
  170.  
  171.       var1.addSeparator();
  172.       JMenuItem var17 = ((JPopupMenu)var1).add(UI.getString("oq.enumeration"));
  173.       ((AbstractButton)var17).addActionListener(this.enumerationAction);
  174.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_ENUM"));
  175.       var1.addSeparator();
  176.       var17 = ((JPopupMenu)var1).add(UI.getString("oq.length"));
  177.       ((AbstractButton)var17).addActionListener(this.lengthAction);
  178.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_LENGTH"));
  179.       var17 = ((JPopupMenu)var1).add(UI.getString("oq.maxlength"));
  180.       ((AbstractButton)var17).addActionListener(this.maxLengthAction);
  181.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_MAXLENGTH"));
  182.       var17 = ((JPopupMenu)var1).add(UI.getString("oq.minlength"));
  183.       ((AbstractButton)var17).addActionListener(this.minLengthAction);
  184.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_MINLENGTH"));
  185.       var1.addSeparator();
  186.       var17 = ((JPopupMenu)var1).add(UI.getString("oq.pattern"));
  187.       ((AbstractButton)var17).addActionListener(this.patternAction);
  188.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_PATTERN"));
  189.       var17 = ((JPopupMenu)var1).add(UI.getString("oq.encoding"));
  190.       ((AbstractButton)var17).addActionListener(this.encodingAction);
  191.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_ENCODING"));
  192.       var17 = ((JPopupMenu)var1).add(UI.getString("oq.period"));
  193.       ((AbstractButton)var17).addActionListener(this.periodAction);
  194.       var17.setEnabled(this.getSchemaDoc().isSupported("GESTALT_FACET_PERIOD"));
  195.       if (super.dataSource != null) {
  196.          Enumeration var7 = (Enumeration)super.dataSource.getQlickerData("OPTIONS", new Integer(super.table.getEditingRow()));
  197.  
  198.          while(var7.hasMoreElements()) {
  199.             String var8 = (String)var7.nextElement();
  200.             var17 = var1.add(new JMenuItem(var8));
  201.             ((AbstractButton)var17).addActionListener(this.actionListener);
  202.          }
  203.       }
  204.  
  205.       return var1;
  206.    }
  207.  
  208.    // $FF: synthetic method
  209.    static SchemaWin access$7000071(OptionsQlicker var0) {
  210.       return var0.getSchemaWin();
  211.    }
  212. }
  213.